HP Softbench BMS bridge (Unix only)

The SNiFF+ package contains a generic and extendable bridge between the Sniffaccess interface and the HP Softbench Broadcast Message Server (BMS). The bridge consists of two commands that route messages between Sniffaccess and the BMS. The two commands are implemented as shell scripts, are named

sniff_to_softbench.sh and softbench_to_sniff.sh , and are located in $SNIFF_DIR/bin .
This section explains the usage of the bridge and also shows how to extend the bridge with your own commands.
Using the HP Softbench BMS bridge
The commands should be started while SNiFF+ and the Softbench BMS are running and can be executed as background processes. For example, a shell script that starts SNiFF+, the HP Softbench BMS and the bridge could look like this:

Script for starting SNiFF+, Softbench and the bridge |
# # Script for starting SNiFF+, # Softbench and the bridge # |
sniff & | Start SNiFF+ in the background.
softbench & | Start Softbench and the BMS in the background.
sleep 45 | Wait until both programs come up.
sniff_to_softbench.sh & | Start the bridge for communication from SNiFF+ to Softbench.
softbench_to_sniff.sh & | Start the bridge for communication from Softbench to SNiFF+.

sniff_to_softbench.sh
The shell script

sniff_to_softbench.sh registers for SNiFF+ notifications, transforms them, and routes them to Softbench BMS messages via the ciclient program.
The following is the content of sniff_to_softbench.sh with an explanation of its structure and how to extend it:

sniff_to_softbench.sh |
#!/bin/sh # # sniff_to_softbench # # Convert SNiFF+ action notifications to # SoftBench requests. # |
PROG=`basename $0` if [ $# = 0 ]; then | If invoked without arguments, register for all commands. This script is invoked again when a notification from SNiFF+ is received, but this time with arguments (see else branch below).
(echo register '*/'file_changed post nowait $0;\ echo register '*/'checkout_file post nowait $0;\ echo register '*/'checkin_file post nowait $0;\ echo register '*/'lock_file post nowait $0;\ echo register '*/'unlock_file post nowait $0)\ | sniffaccess | Register self with SNiFF+ for all file_changed notifications. If you want to register for other notifications, you have to extend this list (and also the case statement below where the notifications are handled).
else PRE_POST=$1; shift WHEN=$1; shift ACTION=$1; shift ARGS="$@" | Script is invoked with arguments on a notification from SNiFF+. Arguments are: ("PRE"|"POST") ("WAIT"|"NOWAIT") ACTION [ARG S]
case "$ACTION" in file_changed | checkout_file | checkin_file |\ lock_file | unlock_file) # $1 is PROJECT, $2 is PATHNAME DIR=`dirname $2` FILE=`basename $2` echo send_notify FILE-MODIFIED $FILE NULL\ PASS NULL | \ ciclient -directory $DIR ;; *) echo $PROG: cannot convert action $ACTION ;; esac fi exit 0 | On any of the file changed notifications from SNiFF+, send a message to the BMS. You have to extend this case statement if you want to forward other notifications from SNiFF+. This list must match the registration notifications above.

softbench_to_sniff.sh
The shell script softbench_to_sniff.sh registers for Softbench BMS notifications, transforms them, and uses Sniffaccess to react to these notifications.
The following is the content of softbench_to_sniff.sh with an explanation of its structure and how to extend it:

softbench_to_sniff.sh |
#!/bin/sh # # Convert SoftBench notifications to SNiFF+ # requests. # |
if [ -z "${child_proc:-}" ]; then child_proc=1 export child_proc exec ciclient -toolclass SNIFF -mode name \ -o 5 -e $0 fi | Restart this program as a child of ciclient .
unset child_proc PROG=`basename $0` HOSTNAME=`uname -n` echo make_reply_trigger -host $HOSTNAME -action\ FILE-MODIFIED -status PASS >&5 echo make_reply_trigger -action STOP -status\ PASS >&5 | Register self with Softbench for FILE-MODIFIED messages. If you want to register for other messages, you have to add additional echo lines (and also add the corresponding case branches below).
while read COMMAND ARGS do eval $ARGS case $COMMAND in nvreply_trigger) case $action in FILE-MODIFIED) sniffaccess file_changed '*/' `basename\ $operand` ;; STOP) if [ $toolclass = MSG-SERVER ]; then exit 0 fi ;; *) echo $PROG: unknown action: $action ;; esac ;; *) echo $PROG: unknown command: $COMMAND ;; esac done exit 0 | Read and parse Softbench messages and send the corresponding commands to SNiFF+ via Sniffaccess. You have to extend this case statement if you want to handle other messages from Softbench. This list must match the registrations above.